<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
</head>
<body>
<form class="layui-form">
    <div class="layui-form-item">
    <label class="layui-form-label">用户名</label>
    <div class="layui-input-block">
      <input type="text" id="username" name="username" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
    </div>
  </div>
    <div class="layui-form-item">
    <label class="layui-form-label">密码</label>
    <div class="layui-input-block">
      <input type="text" id ="password" name="username" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
    </div>
  </div>
     <div class="layui-form-item">
         <input type="hidden" id="sex" value="">
    <label class="layui-form-label">性别</label>
    <div class="layui-input-block">
      <input lay-filter="sex-filter" type="radio" name="sex" value="0" title="男" checked>
      <input lay-filter="sex-filter" type="radio" name="sex" value="1" title="女">
      <input lay-filter="sex-filter" type="radio" name="sex" value="2" title="保密" disabled>
    </div>
  </div>
</form>
<script src="/static/js/jquery.min.js"></script>
<script src="/static/plugins/layui/layui.js"></script>
<script>
    layui.use(function (){
        var form = layui.form;
        form.on('radio(sex-filter)',function (data){
            $("#sex").val(data.elem.value);
        })
        })
</script>
</body>
</html>